<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JavaScript async / await</title>
</head>
<body>
<script>
  async function getFile() {
    let myPromise = new Promise(function(myResolve, myReject) {
      let req = new XMLHttpRequest();
      req.open('GET', "../JS函数、类、Async/15.html");
      req.onload = function() {
        if (req.status == 200) {
          myResolve(req.response);
        } else {
          myResolve("File not Found");
        }
      };
      req.send();
    });
    document.getElementById("demo").innerHTML = await myPromise;
  }

  getFile();
</script>
</body>
</html>